package com.changfeng.controller;

import com.changfeng.bean.dto.vo.CartToCommodityVO;
import com.changfeng.bean.dto.vo.PayVO;
import com.changfeng.service.OrderService;
import com.changfeng.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/pay")
public class PayController {

    @Autowired
    private OrderService orderService;

    @Autowired
    private PayService payService;

    @PostMapping("/addOrder")
    public Integer addOrder(@RequestBody PayVO vo) {
        return orderService.addOrder(vo.getVo(),vo.getAddressId());
    }

    @GetMapping("/payOrder")
    public Integer payOrder(Integer orderId) {
        return payService.payOrder(orderId);
    }


}
